# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


def forwards_func(apps, schema_editor):
    BookType = apps.get_model("BookType", "BookType")
    db_alias = schema_editor.connection.alias
    BookType.objects.using(db_alias).bulk_create([
        BookType(bookTypeId=1, bookTypeName="计算机类", days=30),
        BookType(bookTypeId=2, bookTypeName="成功学类", days=30),
        BookType(bookTypeId=3, bookTypeName="文学艺术类", days=30),
    ])


def reverse_func(apps, schema_editor):
    BookType = apps.get_model("BookType", "BookType")
    db_alias = schema_editor.connection.alias
    BookType(bookTypeId=1, bookTypeName="计算机类", days=30).delete()
    BookType(bookTypeId=2, bookTypeName="成功学类", days=30).delete()
    BookType(bookTypeId=2, bookTypeName="成功学类", days=30).delete()


class Migration(migrations.Migration):
    # 注明依赖的文件，一定要写
    dependencies = [
        ('BookType', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(forwards_func, reverse_func),
    ]